# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-dnslib
_pkgname=dnslib
pkgver=0.9.23
pkgrel=2
pkgdesc="simple library to encode/decode DNS wire-format packets"
url="https://github.com/paulc/dnslib"
arch="noarch"
license="BSD-2-Clause"
depends="python3"
makedepends="py3-setuptools"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces=py-dnslib # Backwards compatibility
provides=py-dnslib=$pkgver-r$pkgrel # Backwards compatibility

# secfixes:
#   0.9.19-r0:
#     - CVE-2022-22846

build() {
	python3 setup.py build
}

check() {
	PYTHONPATH="$PWD/build/lib" python3 dnslib/test_decode.py
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
34f7772868615b661885edc1f30fea49309c390b3ab249edaac119084eab1a3ba59719509bee50b314bf0c12dcb832b48112efaaea386c562bb47b353fb30ffe  dnslib-0.9.23.tar.gz
"
